
void ex4() {
    vector<float > v(3, 5.0);
    for(float i:v){
        cout<<i<<endl;
    }

    v.push_back(3.0);
    v.push_back(2.5);
    v.push_back(1.4);
    cout<<"**********"<<endl;
    for(float i:v){
        cout<<i<<endl;
    }
    cout<<"-----------"<<endl;
    /*
     * assign 会对变量进行重新赋值
     */
    v.assign(3,5.0);
    for (float i :v){
        cout<<i<<endl;
    }
}

/*
 * 使用一维向量
 */
void ex3() {
    vector<float> v(4);
    v[0] = 4.5;
    v[1] = 2.1;
    v[2] = 8.54;
    v[3] = 9.0;

//    for (int i = 0; i < v.size(); i++) {
//        cout << v[i] << endl;
//    }
    vector<float > v1(4,3.5);
//    for (int j = 0; j < v1.size(); ++j) {
//        cout<<v1[j]<<endl;
//    }

    for(float i:v){
        cout<<i<<endl;
    }
    for(float i:v1){
        cout<<i<<endl;
    }

}

/*
 * 使用标准命名空间
 */
void ex2() {
    string fruit = "apple";
    string vegetables = "beockli";
    cout << "my favrite fruit is " << fruit << endl;
    cout << "my favrite vegetables is " << vegetables << endl;
}

void ex1() {/*导入向量库，并声明3个向量变量*/
    std::vector<int> vector1;
    std::vector<int> vector2;
    std::vector<int> vector3;
}